package open3366pvp.as3.dataStruct
{
	import flash.utils.ByteArray;
	
	import open3366pvp.as3.Open3366PvpEvent;
	
	/**
	 * 简单桌子信息 
	 * @author mandyxiong
	 * 
	 */	
	public class TableProp implements IPvpInfo
	{
		public var gameId:uint;
		public var uid:String;
		public var zoneId:int;
		public var roomId:int;
		public var tableId:int;
		
		private var _cmdId:int;
		
		public function TableProp(cmdId:int)
		{
			_cmdId = cmdId;
		}
		
		public function parasData(data:ByteArray):void
		{
			uid = data.readUTFBytes(32);
			gameId = data.readUnsignedInt();
			zoneId = data.readInt();
			roomId = data.readInt();
			tableId = data.readInt();
		}
		
		public function get eventType():String
		{
			var str:String = "";
			switch(_cmdId)
			{
				case 302: str = Open3366PvpEvent.ENTER_TABLE; break;
				case 303: str = Open3366PvpEvent.QUICK_ENTER_GAME; break;
				case 306: str = Open3366PvpEvent.CREATE_AND_SET_TABLE_PROP; break;
			}
			return str;
		}
		
		public function toString():String
		{
			var str:String = "\n uid :" + uid + ", gameId" + gameId + ", zoneId" + zoneId + ", roomId " + roomId + ", tableId " + tableId;
			switch(_cmdId)
			{
				case 302: str = "进入游戏桌子成功！！！" + str; break;
				case 303: str = "快速进入成功！！！" + str; break;
				case 306: str = "创建并设置桌子属性成功！！！" + str; break;
			}
			return str;
		}
	}
}